﻿namespace Vibstudio.NetConfigurator.UI.Model
{
    #region Namespaces

    using System.Collections.Generic;
    using System.Linq;

    using ResultConfigurationModel = Vibstudio.NetConfigurator.Model.ResultConfiguration;

    #endregion

    public sealed class ResultConfigurationCollection : ResultCollectionBase<ResultConfiguration>
    {
        #region Ctor(s)

        public ResultConfigurationCollection(IEnumerable<ResultConfigurationModel> collection)
            : base(AdaptResult(collection))
        {
        }

        #endregion

        #region Methods

        private static IEnumerable<ResultConfiguration> AdaptResult(
            IEnumerable<ResultConfigurationModel> collection)
        {
            return
                collection
                    .Select(r => new ResultConfiguration(r.Application, r.Configuration, r.IsValid, r.Message))
                    .ToList();
        }

        #endregion
    }
}